set scrollbufsize 500000


**** User needs to load data set "high-tech exports data.xlsx" into stata data editor ********************

**** for the do file to run properly, the follwing configurations/programs must be installed:
**** install outreg2 in stata with command "ssc install outreg2"
**** install xtabond2 in stata with command "ssc install xtabond2" 
**** at the command line, enter "mata: mata set matafavor speed, perm"


xtset panelid year


*************** summary stats *****************

sum hightech_exports goveff rol radexpend_sharegdp tariff_rate oilrents_sharegdp gdp_constusd_bill gdppc_constusd_1000 researchers_in_rd_per1000 


*********** correlation matrix ********************

cor hightech_exports goveff rol radexpend_sharegdp tariff_rate oilrents_sharegdp gdp_constusd_bill gdppc_constusd_1000 researchers_in_rd_per100



************************************* table 2 in paper *************************************************************************


xtreg hightech_exports  goveff i.year, fe vce(cluster panelid)
est store m1
outreg2 [m1] using results_2, append excel dec(3)  

xtreg hightech_exports  goveff rol i.year, fe vce(cluster panelid)
est store m1
outreg2 [m1] using results_2, append excel dec(3)  

xtreg hightech_exports  goveff rol radexpend_sharegdp i.year, fe vce(cluster panelid)
est store m1
outreg2 [m1] using results_2, append excel dec(3)  

xtreg hightech_exports  goveff rol radexpend_sharegdp tariff_rate i.year, fe vce(cluster panelid)
est store m1
outreg2 [m1] using results_2, append excel dec(3)  

xtreg hightech_exports  goveff rol radexpend_sharegdp tariff_rate oilrents_sharegdp i.year, fe vce(cluster panelid)
est store m1
outreg2 [m1] using results_2, append excel dec(3)  

xtreg hightech_exports goveff rol radexpend_sharegdp tariff_rate oilrents_sharegdp gdp_constusd_bill i.year, fe vce(cluster panelid)
est store m1
outreg2 [m1] using results_2, append excel dec(3)  

xtreg hightech_exports goveff rol radexpend_sharegdp tariff_rate oilrents_sharegdp gdp_constusd_bill researchers_in_rd_per1000 i.year, fe vce(cluster panelid)
est store m1
outreg2 [m1] using results_2, append excel dec(3)  

xtreg hightech_exports goveff rol radexpend_sharegdp tariff_rate oilrents_sharegdp gdp_constusd_bill researchers_in_rd_per1000 gdppc_constusd_1000  i.year, fe vce(cluster panelid)
est store m1
outreg2 [m1] using results_2, append excel dec(3)



***************** table 3 in paper  ********************************************************************************


xtreg hightech_exports  goveff rol meanschool i.year, fe vce(cluster panelid)
est store m1
outreg2 [m1] using results_3, append excel dec(3)  

xtreg hightech_exports  goveff rol meanschool radexpend_sharegdp i.year, fe vce(cluster panelid)
est store m1
outreg2 [m1] using results_3, append excel dec(3)  

xtreg hightech_exports  goveff rol meanschool radexpend_sharegdp tariff_rate i.year, fe vce(cluster panelid)
est store m1
outreg2 [m1] using results_3, append excel dec(3)  

xtreg hightech_exports goveff rol meanschool radexpend_sharegdp tariff_rate oilrents_sharegdp i.year, fe vce(cluster panelid)
est store m1
outreg2 [m1] using results_3, append excel dec(3)  

xtreg hightech_exports goveff rol meanschool radexpend_sharegdp tariff_rate oilrents_sharegdp gdp_constusd_bill i.year, fe vce(cluster panelid)
est store m1
outreg2 [m1] using results_3, append excel dec(3)  

xtreg hightech_exports goveff rol meanschool radexpend_sharegdp tariff_rate oilrents_sharegdp gdp_constusd_bill researchers_in_rd_per1000 i.year, fe vce(cluster panelid)
est store m1
outreg2 [m1] using results_3, append excel dec(3)  

xtreg hightech_exports goveff rol meanschool radexpend_sharegdp tariff_rate  oilrents_sharegdp gdp_constusd_bill researchers_in_rd_per1000 gdppc_constusd_1000 i.year, fe vce(cluster panelid)
est store m1
outreg2 [m1] using results_3, append excel dec(3)



********** table 4 in paper - gmm estimates: var-cov matrix: H(3); dealing with instrument proliferation: no restristion, lags 1 to 3; lags 1 to 2; pca *********************************


xi: xtabond2 hightech_exports goveff rol radexpend_sharegdp tariff_rate oilrents_sharegdp gdp_constusd_bill researchers_in_rd_per1000 gdppc_constusd_1000 i.year, gmm(L.(goveff rol)) iv(radexpend_sharegdp tariff_rate oilrents_sharegdp gdp_constusd gdppc_constusd researchers_in_rd_permill) h(3) robust twostep 
est store m1
outreg2 [m1] using results_4, append excel dec(3)  

xi: xtabond2 hightech_exports goveff rol radexpend_sharegdp tariff_rate oilrents_sharegdp gdp_constusd_bill researchers_in_rd_per1000 gdppc_constusd_1000 i.year, gmm(L.(goveff rol), lag(1 3) ) iv(radexpend_sharegdp tariff_rate oilrents_sharegdp gdp_constusd gdppc_constusd researchers_in_rd_permill) h(3) robust twostep 
est store m1
outreg2 [m1] using results_4, append excel dec(3)  

xi: xtabond2 hightech_exports goveff rol radexpend_sharegdp tariff_rate oilrents_sharegdp gdp_constusd_bill researchers_in_rd_per1000 gdppc_constusd_1000 i.year, gmm(L.(goveff rol), lag(1 2) ) iv(radexpend_sharegdp tariff_rate oilrents_sharegdp gdp_constusd gdppc_constusd researchers_in_rd_permill) h(3) robust twostep 
est store m1
outreg2 [m1] using results_4, append excel dec(3)  

xi: xtabond2 hightech_exports goveff rol radexpend_sharegdp tariff_rate oilrents_sharegdp gdp_constusd_bill researchers_in_rd_per1000 gdppc_constusd_1000 i.year, gmm(L.(goveff rol)) iv(radexpend_sharegdp tariff_rate oilrents_sharegdp gdp_constusd gdppc_constusd researchers_in_rd_permill) h(3) robust twostep pca
est store m1
outreg2 [m1] using results_4, append excel dec(3)  

















